#!/bin/bash
set -e

PLATFORM=$(uname -s)
BUILD_DIR="build_${PLATFORM}"
DIST_DIR="dist/${PLATFORM}"

# 清理历史构建
rm -rf ${BUILD_DIR} ${DIST_DIR}

# 执行构建
pyinstaller \
    --name "领航部署专家" \
    --icon src/resources/icon.ico \
    --add-data "src/resources/*:resources" \
    --noconsole \
    --clean \
    --distpath ${DIST_DIR} \
    --workpath ${BUILD_DIR} \
    src/main/cli.py

# 生成SHA256校验文件
cd ${DIST_DIR}
shasum -a 256 领航部署专家 > SHA256SUMS